#include "protocol.h"

typedef struct
{
    u8 *buf;
    u16 start;
    u8 nrs;
    u32 last_tick;
    u32 period;
    u32 baudrate;
    u32 okcount,errcount;
    u8 data_bits;
    u8 stop_bits;
    u8 parity;
    u8 enable;
    u8 id;
    short status;

} request_t;
class danpianji : public protocol
{
public:
    int init(u8 serialNo);
    void thread();
    int query(request_t *);
    int hand(request_t *);
    int read(request_t *);
    int process_hand(u8 c, request_t *);
    int process_read(u8 c, request_t *);

private:
    int state,datalen;
    u32 last_tick;
    u8 request_nrs;
    u8 _rxbuf[64];
};
extern request_t request[];